package com.project.handle.travelHandle;

import com.project.handle.RiskHandle;
import com.project.pojo.RiskController;
import com.project.utils.ErrorMessage;
import com.project.vo.TripAccessVO;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

import java.util.List;
@Component
@Order(3)
public class TravelHandleOfHealth implements RiskHandle<TripAccessVO> {
    @Override
    public void RiskAssess(TripAccessVO tripAccessVO, List<RiskController> list, List<ErrorMessage> errorMessageList) {
        for (RiskController riskController : list) {
            if (riskController.getRule().equals(tripAccessVO.getIshealth())){
                tripAccessVO.setWeight(tripAccessVO.getWeight()+riskController.getWeight());
            }
        }
    }
}
